package com.amex.uam.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.amex.uam.dao.AmexUnitDao;
import com.amex.uam.model.AMEX_UNIT;
import com.amex.uam.model.Message;
import com.amex.uam.service.AmexUnitService;
import com.amex.uam.util.Utils;

@Service("amexUnitService")
public class AmexUnitServiceImpl implements AmexUnitService {

	private AmexUnitDao amexUnitDao;

	@Resource
	public void setAmexUnitDao(AmexUnitDao amexUnitDao) {
		this.amexUnitDao = amexUnitDao;
	}

	@Override
	public Message updateAmexUnit(AMEX_UNIT unit) {
		int status = Message.OK;
		if (unit == null || Utils.isEmpty(unit.getAMEX_UNIT_CD())){
			status = Message.ERROR_PARAM;
		} else {
			boolean success = amexUnitDao.updateAmexUnit(unit);
			if (success == false) {
				status = Message.ERROR;
			}
		}
		return new Message(status);
	}
	
}
